/**
 * 
 */
package multidomain;

import tracing.OBGPTracer;
import tracing.Trace;
import tracing.Tracer;
import wdmsim.PhysicalTopology;
import wdmsim.SimulationRunner;
import wdmsim.Simulator;
import wdmsim.TrafficGenerator;

/**
 * @author alissonslp
 *
 */
public class MultiDomainSimulator {
	
	public static TrafficGenerator trafficGenerator;
	
	public MultiDomainSimulator() {
		
		try {
			// build physicalTopology
			PhysicalTopology pt = PhysicalTopology.getInstance();
			
			if(Simulator.RWA_MODE.matches("pce-based")) {
				Domain.processPCEs();
			} else if(Simulator.RWA_MODE.matches("obgp")){			
				// define controlPlane type
				Domain.initiateDomainsStructures();
				
			} else {
				throw new Exception();
			}
			
			// generate traffic
			trafficGenerator = new TrafficGenerator();
			
			Trace trace = null;
			if(Simulator.RWA_MODE.matches("pce-based")) {
				trace = Tracer.getTracerObject();
			} else {			
				// define controlPlane type
				trace = OBGPTracer.getTracerObject();
			}
			
			long begin = System.currentTimeMillis();
			new SimulationRunner();
			
			trace.showAllResults(begin);
			
		} catch (Throwable t) {
			t.printStackTrace();
		}
		
	}
}
